package cn.itcast.user.web;

import cn.itcast.user.User;
import cn.itcast.user.config.PatternProperties;
import cn.itcast.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.regex.Pattern;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private PatternProperties patternProperties;

    /**
     * 路径： /user/110
     *
     * @param id 用户id
     * @return 用户
     */
        @GetMapping("/{id}") //http://localhost:8081/user/6
        public User queryById(@PathVariable("id") Long id) {
            return userService.queryById(id);
        }


    @GetMapping("/prop")
    public PatternProperties prop(){
        return patternProperties;
    }

}
